/*    */ package com.gillion.grule.client.validator;
/*    */ 
/*    */ import java.util.Map;
/*    */ import java.util.regex.Pattern;
/*    */ import org.apache.commons.lang3.Validate;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class PatternValidatorServiceImpl
/*    */   implements ValidatorService
/*    */ {
/*    */   public boolean validate(String key, Object value, Map<String, Object> settings) {
/* 18 */     Validate.notNull(settings, "正则校验规则设置不能为空", new Object[0]);
/* 19 */     Validate.notNull(settings.get("pattern"), "正则校验规则设置不能为空", new Object[0]);
/* 20 */     Pattern pattern = Pattern.compile(settings.get("pattern").toString());
/* 21 */     if (value != null && value instanceof String && !pattern.matcher((String)value).matches()) {
/* 22 */       return false;
/*    */     }
/* 24 */     return true;
/*    */   }
/*    */ }


/* Location:              D:\apache-tomcat-9.0.76\webapps\grule-manager\WEB-INF\lib\grule-client-2.0.2.RELEASE.jar!\com\gillion\grule\client\validator\PatternValidatorServiceImpl.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */